package com.bw.medical.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bw.medical.entity.TbDepartmentEntity;
import com.bw.medical.vo.Cha;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bw.common.utils.PageUtils;
import com.bw.common.utils.Query;

import com.bw.medical.dao.TbDiagnoseDao;
import com.bw.medical.entity.TbDiagnoseEntity;
import com.bw.medical.service.TbDiagnoseService;


@Service("tbDiagnoseService")
public class TbDiagnoseServiceImpl extends ServiceImpl<TbDiagnoseDao, TbDiagnoseEntity> implements TbDiagnoseService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Integer userId = Integer.valueOf(params.get("userId").toString());
        IPage<TbDiagnoseEntity> page = this.page(
                new Query<TbDiagnoseEntity>().getPage(params),
                new QueryWrapper<TbDiagnoseEntity>().eq("userId", userId)
        );

        return new PageUtils(page);
    }

    @Override
    public IPage<TbDiagnoseEntity> getList(Map<String, Object> params) {
        Page<TbDepartmentEntity> page = new Page<>(Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("limit").toString()));
        return baseMapper.getList(page, Integer.valueOf(params.get("userId").toString()));
    }

    @Override
    public IPage<Cha> getPlist(Map<String, Object> params) {
        Page<TbDepartmentEntity> page = new Page<>(Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("limit").toString()));
        return baseMapper.getPlist(page, Integer.valueOf(params.get("docterId").toString()));
    }

}